<template>
  <div class="GdwyyAppyxgdDetail">
    <!-- 表单 -->
    <div class="form-box flex-center fill-w" @click="showPopup = true">
      <div class="flex-center">
        <img
          class="arr-icon"
          :src="require(`../../../../../../assets/imgs/reconsitution/viewAllWorkOrders/icon_ddzt.png`)"
        />
        <div class="label font-14 color999">订单状态</div>
      </div>

      <div class="value flex-1">{{ currentItem.label }}</div>

      <van-icon name="arrow-down" class="color999" />
    </div>
    <GdwyyAppyxgdDetailTable
      :addQueryParam="addQueryParam"
      :showNav="false"
      ref="GdwyyAppyxgdDetailTableRef"
    ></GdwyyAppyxgdDetailTable>

    <van-popup v-model="showPopup" position="bottom">
      <van-picker
        show-toolbar
        title="请选择订单状态"
        :columns="ddztArr"
        :default-index="currentItemIndex"
        @confirm="onConfirm"
        @cancel="showPopup = false"
      />
    </van-popup>
  </div>
</template>
  
  <script>
import { showZwtNav } from '@/utils/showNav.js'
import GdwyyAppyxgdDetailTable from './detailTable.vue'
export default {
  name: 'GdwyyAppyxgdDetail',
  components: { GdwyyAppyxgdDetailTable },
  data() {
    return {
      pageTitle: '',
      addQueryParam: {
        result: 1,
      },
      currentItem: {
        label: '全部',
      },
      showPopup: false,
      currentItemIndex: 0,
      ddztArr: ['全部', '已完成'],
      ddztList: [
        {
          value: 1,
          label: '全部',
        },
        {
          value: 2,
          label: '已完成',
        },
      ],
    }
  },

  created() {
    const { pageTitle } = this.$route.query
    this.$route.meta.title = this.pageTitle = pageTitle
    showZwtNav(pageTitle)
  },

  methods: {
    onConfirm(value, index) {
      this.currentItem = this.ddztList[index]
      this.showPopup = false
      this.addQueryParam.result = this.currentItem.value
      this.$refs.GdwyyAppyxgdDetailTableRef.getTableData()
    },
  },
}
</script>
  
  <style lang="less" scoped>
@import '~@assets/less/reconsitution/common.less';

.GdwyyAppyxgdDetail {
  padding: 0 8px;
  box-sizing: border-box;
  background: #fff;
  height: 100vh;
  padding-top: 20px;

  .form-box {
    background: #f6f6f6;
    border-radius: 20px;
    padding: 6px 10px;

    .value {
      margin-left: 20px;
    }

    .arr-icon {
      width: 14px;
      height: 14px;
      margin-right: 5px;
    }
  }
}
</style>